package com.yami.shop.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.model.Post;
import com.yami.shop.bean.model.TopicParticipation;
import com.yami.shop.common.util.PageParam;
import com.yami.shop.dao.TopicParticipationMapper;
import com.yami.shop.service.TopicParticipationService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用于记录用户参与的话题及其相关的动态 服务实现类
 * </p>
 *
 * @author EXiaoKe
 * @since 2025-04-14
 */
@Service
public class TopicParticipationServiceImpl extends ServiceImpl<TopicParticipationMapper, TopicParticipation> implements TopicParticipationService {


    @Resource
    private TopicParticipationMapper participationMapper;

    /**
     * @param topicId
     * @return
     */
    @Override
    public Integer countParticipations(Long topicId) {
        return null;
    }

    @Override
    public List<Long> findTopicIdsByPostId(Long postId) {
        return participationMapper.findTopicIdsByPostId(postId);
    }

    /**
     * 添加话题和帖子关联信息
     *
     * @param topicId
     * @param postId
     */
    @Override
    public void addTopicWithPost(Long topicId, Long postId) {
        TopicParticipation participation = new TopicParticipation();
        participation.setTopicId(topicId);
        participation.setPostId(postId);
        participationMapper.insert(participation);
    }

    @Override
    public TopicParticipation pageByPage(PageParam page, TopicParticipation topic) {
        return null;
    }
}
